Repository navigation
Full packmsg port: fix mismatches vs WSJT-X reference (28/28) - #43
Merged
Merged
Conversation
The compact free-text encoder (base-42 + freeform flag) is kept as the default so the Uno stays lean. Defining JTENCODE_FULL_PACKMSG selects a faithful C++ port of WSJT-X packjt.f90 (packmsg + packcall + getpfx1 + packgrid + grid2deg + packtext + entail): type detection, CQ/QRZ/DE and Swaziland/Guinea workarounds, 339-entry prefix and 12-entry suffix tables, Maidenhead/report packing with the extended KA/LA report range, and free-text fallback. Measured on arduino:avr:uno: compact 18,088 B flash / 353 B RAM; full path 25,804 B flash (79%) / 475 B RAM. On arduino:renesas_uno:unor4wifi: compact 62,120 B (23%) / full 67,304 B (25%) flash. JT65 uses the 12-byte dat block directly (no entail); JT9/JT4 use entail. Harness passes 20/20 with both paths. README documents the option.
Verifies itype detection and the dat-byte layout for standard, CQ, suffix, free-text, report and extended-report messages when JTENCODE_FULL_PACKMSG is defined. Runs as part of tests/run_tests.sh.
The example sketch builds on Uno only with the compact path (the full path overflows 32 KB: 36.3 KB vs 32,256 B). It builds with both paths on the Uno R4 WiFi. Also note that its free-text message encodes identically in both paths.
- Intro: mention that JT65/JT9/JT4 accept standard WSJT-X messages with JTENCODE_FULL_PACKMSG (callsign/grid/report, CQ/QRZ/DE prefixes, /P suffixes) - jt65/jt9/jt4_encode doc comments: note the compact path (default) is Type 6 free-text and the full path accepts standard messages - Example sketch header comment: note the standard-message capability when the full path is enabled
Verified bit-exact against the WSJT-X Fortran reference driver (itype, dat, entail) after three fixes: - grid2deg: copy all 6 grid characters (was truncating to 5, dropping the 6th and corrupting extended KA/LA reports) - c3 fill loop: map NUL bytes to blanks (blank grids forced free-text fallback) - getpfx1: fall through to the generic prefix/suffix path when the pfx/sfx tables miss, and keep a copy of the original callsign for the generic path (was returning early with a stale/rebuilt callsign) - packmsg: honor the Fortran early exits (nv2a >= 4, text1, text2 -> free text) and the add-on grid k1<0 || k2<0 || k1*k2!=0 check Regression test updated to the corrected reference outputs and now also covers the /X suffix and gridless standard message. Build verified: Uno compact (28.4 KB), Uno R4 WiFi compact (72.2 KB) and full (77.3 KB); Uno full-path overflows by design.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
The full packmsg port (
JTENCODE_FULL_PACKMSG) mismatched the WSJT-X Fortran reference on 16 of 28 messages (itype OK in most cases, dat/entail off). Three defects, all fixed here and verified against the Fortran reference driver:grid2degtruncated the grid to 5 chars — a 6-char input (e.g.CN84mm) lost its 6th character, so the 6th-char check and the 6th-char xminlat computation were wrong (extended reports off by ~5 in the last byte). Now copies all 6 characters.NT7S K1ABC) hadc3[0] = 0, forcing free-text fallback. NUL is now mapped to blank.getpfx1returned early on table miss — forNT7S K1ABC/X CN84(suffixXnot in the sfx table) the port kept nv2=1/k=0 and returned, skipping the compound-suffix fallback (nv2=5, 37-based k). It now falls through to the generic path, which also keeps a copy of the original callsign (the add-on branches rebuildcallsignin place).Also fixed to match the Fortran exactly: the early exits in
packmsg(nv2a >= 4,text1,text2-> free text) and the add-on gridk1 < 0 || k2 < 0 || k1*k2 != 0check.Verification
28/28 messages pass against the WSJT-X Fortran reference driver (itype, dat, entail — all 28 messages, including the previously-mismatched
NT7S K1ABC,G0ABC M0SUP,NT7S K1ABC/X CN84, and the 5-offset extended-report cases).Harness: 20/20 PASS plus the full packmsg regression test (now updated to the corrected reference outputs and extended with the /X suffix and gridless standard message).
Builds: Uno compact 28,438 B (88%, unchanged), Uno full-path overflows by design (documented), Uno R4 WiFi compact 72,216 B / full 77,312 B.
Note
Stacked on
fix/jt4-implementation(PR #42). Do not merge without Jason's OK; PR #42 must merge first.